import request from '@/config/axios'

// ERP 能耗单位 VO
export interface EnergyUnitVO {
  id: number // 单位编号
  name: string // 单位名字
  sort: number // 排序
}

// ERP 能耗单位 API
export const EnergyUnitApi = {
  // 查询ERP 能耗单位分页
  getEnergyUnitPage: async (params: any) => {
    return await request.get({ url: `/erp/energy-unit/page`, params })
  },

  // 查询ERP 能耗单位详情
  getEnergyUnit: async (id: number) => {
    return await request.get({ url: `/erp/energy-unit/get?id=` + id })
  },

  // 新增ERP 能耗单位
  createEnergyUnit: async (data: EnergyUnitVO) => {
    return await request.post({ url: `/erp/energy-unit/create`, data })
  },

  // 修改ERP 能耗单位
  updateEnergyUnit: async (data: EnergyUnitVO) => {
    return await request.put({ url: `/erp/energy-unit/update`, data })
  },

  // 删除ERP 能耗单位
  deleteEnergyUnit: async (id: number) => {
    return await request.delete({ url: `/erp/energy-unit/delete?id=` + id })
  },

  // 导出ERP 能耗单位 Excel
  exportEnergyUnit: async (params) => {
    return await request.download({ url: `/erp/energy-unit/export-excel`, params })
  }
}
